﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HSDc.RingleFlow.Api.Rule;

namespace HSDc.RingleFlow.Kernel
{
    class Transition
    {
        private Activity _source;
        private Activity _target;
        private string _constraints;
        internal Transition(Activity _source, string _constraints) 
        {
            this._source = _source;
            this._constraints = _constraints;
        }
        internal Transition(Activity _source, Activity _target, string _constraints)
        {
            this._source = _source;
            this._target = _target;
            this._constraints = _constraints;
        }
        internal void AddTarget(Activity _target)
        {
            this._target = _target;
        }

        internal virtual Activity Go()
        {
            return _target;
        }

        internal virtual Activity Source
        {
            get { return _source; }
        }

        internal virtual Activity Target
        {
            get { return _target; }
        }

        internal bool CheckConstraints(string _constraints)
        {
            return ((string.IsNullOrEmpty(this._constraints)) ||
                       (_constraints.Equals(this._constraints)));
        }
    }
}
